package utility;

import java.util.Hashtable;

public class RunUnixCommand 
{
	void Command(String scriptname)
	{
		String strScriptPath="/usr/pwapp/pw/System/SqlScript/"+scriptname;
		System.out.println(strScriptPath);
		String strCommand="";
		//strCommand = "/usr/bin/mysql#--user=root#--password=da5idce1ine#pw#<#"+strScriptPath +"#>#"+strRootPath+"/pw/System/SqlScript/sqloutput.txt";
		//strCommand = "/usr/bin/mysql --user=root --password=da5idce1ine pw < "+strScriptPath+" > "+strRootPath+"/pw/System/SqlScript/sqloutput.txt";
		//String[] Command=strCommand.split("#");

		Process p=null;
		Runtime rt=null;
		//p = rt.getRuntime().exec(strCommand);
		strCommand= "/usr/pwapp/pw/System/SqlScript/userMgmtScripts.sh pw root cohezia "+strScriptPath;
		
		int exitVal;
		try {
			p = rt.getRuntime().exec(strCommand);
			exitVal = p.waitFor();
			System.out.println("Script exit value: "+exitVal);
		} 
		catch (Exception e) 
		{
			e.printStackTrace();
		}
		
		//System.out.println(strCommand);
		System.out.println("Exceuted successfully");
	}
	
}
